
function login() {
    const userId = document.getElementById('userId').value;
    const password = document.getElementById('loginPassword').value;

    if (userId.trim() === '') {
        document.getElementById('errorMessage').innerHTML = '用户ID不能为空。';
        return false;
    }

    if (password.trim() === '') {
        document.getElementById('errorMessage').innerHTML = '密码不能为空。';
        return false;
    }
    return true;
}
window.onload = ()=> {
    //获取img标签的对象
    let img = document.getElementById("exchangeCode");
    img.onclick = function () {
        //加时间戳,避免浏览器缓存
        const date = new Date().getTime()
        img.src = "VerifyCodeServlet?" + date;
    }
    //获取a标签的对象
    let ec = document.getElementById("eCode");
    ec.onclick = function () {
        //加时间戳
        const date = new Date().getTime()
        img.src = "VerifyCodeServlet?" + date;
    }
}
